surface: Drop popup api
authorMatthias Clasen <mclasen@redhat.com>
Wed, 11 Mar 2020 05:15:43 +0000 (01:15 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 11 Mar 2020 23:35:55 +0000 (19:35 -0400)
We have the GdkPopup interface now.

gdk/gdksurface.c
gdk/gdksurface.h

index cf0b1874b2272d2d8cd6f6c2459f73ef0beb2f73..188c8dc230ba5fe17bfb74bc3af9d99ceda053b2 100644 (file)
@@ -794,26 +794,6 @@ gdk_surface_new_popup (GdkSurface *parent,
   return surface;
 }
 
-/**
- * gdk_surface_get_parent:
- * @surface: a #GtkSurface
- *
- * Returns the parent surface of a surface, or
- * %NULL if the surface does not have a parent.
- *
- * Only popup surfaces have parents.
- *
- * Returns: (transfer none) (nullable): the parent of
- *   @surface, or %NULL
- */
-GdkSurface *
-gdk_surface_get_parent (GdkSurface *surface)
-{
-  g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
-  
-  return surface->parent;
-}
-
 static void
 update_pointer_info_foreach (GdkDisplay           *display,
                              GdkDevice            *device,
@@ -986,33 +966,6 @@ gdk_surface_is_destroyed (GdkSurface *surface)
   return GDK_SURFACE_DESTROYED (surface);
 }
 
-/**
- * gdk_surface_get_position:
- * @surface: a #GdkSurface
- * @x: (out): X coordinate of surface
- * @y: (out): Y coordinate of surface
- *
- * Obtains the position of the surface relative to its parent.
- **/
-void
-gdk_surface_get_position (GdkSurface *surface,
-                          int        *x,
-                          int        *y)
-{
-  g_return_if_fail (GDK_IS_SURFACE (surface));
-
-  if (surface->parent)
-    {
-      *x = surface->x;
-      *y = surface->y;
-    }
-  else
-    {
-      *x = 0;
-      *y = 0;
-    }
-}
-
 /**
  * gdk_surface_get_mapped:
  * @surface: a #GdkSurface
@@ -2060,73 +2013,6 @@ gdk_surface_resize (GdkSurface *surface,
   GDK_SURFACE_GET_CLASS (surface)->toplevel_resize (surface, width, height);
 }
 
-/**
- * gdk_surface_present_popup:
- * @surface: the popup #GdkSurface to show
- * @width: the unconstrained popup width to layout
- * @height: the unconstrained popup height to layout
- * @layout: the #GdkPopupLayout object used to layout
- *
- * Present @surface after having processed the #GdkPopupLayout rules. If the
- * popup was previously now showing, it will be showed, otherwise it will
- * change position according to @layout.
- *
- * After calling this function, the result of the layout can be queried
- * using gdk_surface_get_position(), gdk_surface_get_width(),
- * gdk_surface_get_height(), gdk_surface_get_popup_rect_anchor() and
- * gdk_surface_get_popup_surface_anchor().
- *
- * Presenting may have fail, for example if it was immediately hidden if the
- * @surface was set to autohide.
- *
- * Returns: %FALSE if it failed to be presented, otherwise %TRUE.
- */
-gboolean
-gdk_surface_present_popup (GdkSurface     *surface,
-                           int             width,
-                           int             height,
-                           GdkPopupLayout *layout)
-{
-  g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
-  g_return_val_if_fail (surface->parent, FALSE);
-  g_return_val_if_fail (layout, FALSE);
-  g_return_val_if_fail (!GDK_SURFACE_DESTROYED (surface), FALSE);
-  g_return_val_if_fail (width > 0 && height > 0, FALSE);
-
-  return GDK_SURFACE_GET_CLASS (surface)->present_popup (surface,
-                                                         width,
-                                                         height,
-                                                         layout);
-}
-
-/**
- * gdk_surface_get_popup_surface_anchor:
- * @surface: a #GdkSurface
- *
- * Get the current popup surface anchor. The value returned may chage after
- * calling gdk_surface_show_popup(), gdk_surface_layout_popup() or after the
- * "popup-layout-changed" is emitted.
- */
-GdkGravity
-gdk_surface_get_popup_surface_anchor (GdkSurface *surface)
-{
-  return surface->popup.surface_anchor;
-}
-
-/**
- * gdk_surface_get_popup_rect_anchor:
- * @surface: a #GdkSurface
- *
- * Get the current popup anchor rectangle anchor. The value
- * returned may chage after calling gdk_surface_show_popup(),
- * gdk_surface_layout_popup() or after the "popup-layout-changed" is emitted.
- */
-GdkGravity
-gdk_surface_get_popup_rect_anchor (GdkSurface *surface)
-{
-  return surface->popup.rect_anchor;
-}
-
 static gboolean
 gdk_popup_surface_present (GdkPopup       *popup,
                            int             width,
@@ -2136,8 +2022,10 @@ gdk_popup_surface_present (GdkPopup       *popup,
   GdkSurface *surface = GDK_SURFACE (popup);
 
   g_return_val_if_fail (surface->surface_type == GDK_SURFACE_POPUP, FALSE);
+  g_return_val_if_fail (surface->parent, FALSE);
+  g_return_val_if_fail (!GDK_SURFACE_DESTROYED (surface), FALSE);
 
-  return gdk_surface_present_popup (surface, width, height, layout);
+  return GDK_SURFACE_GET_CLASS (surface)->present_popup (surface, width, height, layout);
 }
 
 static GdkGravity
@@ -2147,7 +2035,7 @@ gdk_popup_surface_get_surface_anchor (GdkPopup *popup)
 
   g_return_val_if_fail (surface->surface_type == GDK_SURFACE_POPUP, GDK_GRAVITY_STATIC);
 
-  return gdk_surface_get_popup_surface_anchor (surface);
+  return surface->popup.surface_anchor;
 }
 
 static GdkGravity
@@ -2157,7 +2045,7 @@ gdk_popup_surface_get_rect_anchor (GdkPopup *popup)
 
   g_return_val_if_fail (surface->surface_type == GDK_SURFACE_POPUP, GDK_GRAVITY_STATIC);
 
-  return gdk_surface_get_popup_rect_anchor (surface);
+  return surface->popup.rect_anchor;
 }
 
 static int
@@ -4196,20 +4084,3 @@ gdk_surface_translate_coordinates (GdkSurface *from,
 
   return TRUE;
 }
-
-/**
- * gdk_surface_get_autohide:
- * @surface: a #GdkSurface
- *
- * Returns whether this surface is set to hide on outside clicks.
- *
- * Returns: %TRUE if @surface will autohide
- */
-gboolean
-gdk_surface_get_autohide (GdkSurface *surface)
-{
-  g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
-
-  return surface->autohide;
-}
-
index 6f24140ece6079bf1d7b8b55c80a799c29517edd..bc0753c5b925ed183563c6f3749a7b504143f873 100644 (file)
@@ -350,9 +350,6 @@ GdkSurfaceType gdk_surface_get_surface_type     (GdkSurface     *surface);
 GDK_AVAILABLE_IN_ALL
 gboolean      gdk_surface_is_destroyed          (GdkSurface     *surface);
 
-GDK_AVAILABLE_IN_ALL
-GdkSurface *  gdk_surface_get_parent            (GdkSurface     *surface);
-
 GDK_AVAILABLE_IN_ALL
 GdkDisplay *  gdk_surface_get_display           (GdkSurface     *surface);
 GDK_AVAILABLE_IN_ALL
@@ -365,15 +362,6 @@ GDK_AVAILABLE_IN_ALL
 void          gdk_surface_resize                (GdkSurface     *surface,
                                                  gint           width,
                                                  gint           height);
-GDK_AVAILABLE_IN_ALL
-gboolean      gdk_surface_present_popup         (GdkSurface     *surface,
-                                                 int             width,
-                                                 int             height,
-                                                 GdkPopupLayout *layout);
-GDK_AVAILABLE_IN_ALL
-GdkGravity    gdk_surface_get_popup_surface_anchor (GdkSurface     *surface);
-GDK_AVAILABLE_IN_ALL
-GdkGravity    gdk_surface_get_popup_rect_anchor    (GdkSurface     *surface);
 
 GDK_AVAILABLE_IN_ALL
 void          gdk_surface_raise                 (GdkSurface     *surface);
@@ -409,9 +397,6 @@ gboolean gdk_surface_is_viewable    (GdkSurface *surface);
 GDK_AVAILABLE_IN_ALL
 gboolean      gdk_surface_get_mapped   (GdkSurface *surface);
 
-GDK_AVAILABLE_IN_ALL
-gboolean      gdk_surface_get_autohide (GdkSurface *surface);
-
 GDK_AVAILABLE_IN_ALL
 GdkSurfaceState gdk_surface_get_state (GdkSurface *surface);
 
@@ -459,10 +444,6 @@ int           gdk_surface_get_width       (GdkSurface       *surface);
 GDK_AVAILABLE_IN_ALL
 int           gdk_surface_get_height      (GdkSurface       *surface);
 GDK_AVAILABLE_IN_ALL
-void          gdk_surface_get_position   (GdkSurface      *surface,
-                                          gint            *x,
-                                          gint            *y);
-GDK_AVAILABLE_IN_ALL
 gboolean gdk_surface_translate_coordinates (GdkSurface *from,
                                             GdkSurface *to,
                                             double     *x,